import { Node } from "@valuation/core";
import { Mark } from "@valuation/core";
import { Schema } from "@rivet/model";
export const Dw = Node.create({
  name: "dw",
  topNode: true,
  content: "fb+",
  marks: "color",
  addAttributes() {
    return {
      name: { default: "" },
      value: { default: 0 },
    };
  },
});

export const Fb = Node.create({
  name: "fb",
  content: "(de|qd)*",
});
export const De = Node.create({
  name: "de",
});
export const Qd = Node.create({
  name: "qd",
  addAttributes() {
    return {
      name: { default: "" },
      email: { default: "" },
    };
  },
});
export const Color = Mark.create({
  name: "color",
  addAttributes() {
    return {
      color: { default: "red" },
    };
  },
});

export function mokeData(schema: Schema) {
  //创建mark
  const userMark = schema.marks.color.create({ value: "blue" });

  const contact = schema.nodes.qd.createChecked("1", {
    name: "Alice",
    email: "alice@example.com",
  }, null);

  const fb = schema.nodes.fb.createChecked("3", {}, [
    contact,
  ], [userMark]);
  return schema.nodes.dw.createChecked("2", { name: "test", value: 0 }, [
    fb,
  ]);
}
